package Process;

/**
 * Creates and manages a Consumer process.
 * 
 * @author Stephen Amos, Zach Turk, Dickson Kwong
 *
 */
public class Consumer extends Process
{
	int mem_index;
	
	public Consumer(int the_id, SysCall[] the_requests, int index) 
	{
		super(the_id, the_requests, 0);
		the_requests[0] = SysCall.SEM_DOWN;
		the_requests[1] = SysCall.MUTEX_LOCK;
		the_requests[the_requests.length/2] = SysCall.MEM_READ;
		the_requests[the_requests.length - 2] = SysCall.MUTEX_UNLOCK;
		the_requests[the_requests.length - 1] = SysCall.SEM_UP;
		this.mem_index = index;
	}

	public int memAddress() {
		return mem_index;
	}
}
